package com.git.contractmanagement.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "alipay")
@Data
public class ZfbConfig {
    private String appId;           // 对应 app-id
    private String appPrivateKey;   // 对应 app-private-key
    private String alipayPublicKey; // 对应 alipay-public-key
    private String gateway;         // 对应 gateway
    private String notifyUrl;

    /*
    * 创建支付宝 SDK 的客户端对象，封装了所有与支付宝交互的请求。
以后你要调支付宝下单、查询、退款等接口，都是通过这个 AlipayClient 来发请求。
    * */
    @Bean

    public AlipayClient setAlipayClient() {
        return new DefaultAlipayClient(gateway, appId, appPrivateKey, "json", "utf-8", alipayPublicKey, "RSA2");


    }
}
